package com.ywu.mq.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.mq.sdk.domain.dto.YwuKafkaDto;
import com.ywu.mq.sdk.domain.entity.YwuKafkaConsumerLogEntity;
import com.ywu.mq.standard.service.YwuKafkaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName YwuKafkaApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/3/28 10:07
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/mq/kafka")
public class YwuKafkaApi {

    @Autowired
    private YwuKafkaService service;

    /**
    * @Author GroundDemo
    * @Description 查询主题的消息列表
    * @Date 12:34 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.message.list.info")
    public CommonResult<Object> queryMessageInfoList(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.queryMessageInfoList(ywuKafkaDto);
    }

    /**
    * @Author GroundDemo
    * @Description 生产消息
    * @Date 10:13 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.produce.info")
    public CommonResult<Object> produceInfo(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.produceInfo(ywuKafkaDto);
    }

    /**
    * @Author GroundDemo
    * @Description 重发消息
    * @Date 10:14 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.produce.resend.info")
    public CommonResult<Object> produceResendInfo(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.produceResendInfo(ywuKafkaDto);
    }

    /**
    * @Author GroundDemo
    * @Description 主题与应用订阅授权
    * @Date 14:28 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.topic.app.sub.info")
    public CommonResult<Object> topicAppSub(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.topicAppSub(ywuKafkaDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询订阅列表
    * @Date 14:49 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.topic.app.sub.list.info")
    public CommonResult<Object> topicAppSubQuery(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.topicAppSubQuery(ywuKafkaDto);
    }

    /**
    * @Author GroundDemo
    * @Description 根据ID删除授权
    * @Date 15:00 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.topic.app.sub.delete.info")
    public CommonResult<Object> deleteTopicSubById(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.deleteTopicSubById(ywuKafkaDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询kafka消费记录
    * @Date 19:48 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.consumer.log.list.info")
    public CommonResult<Object> queryKafkaConsumerLog(@RequestBody YwuKafkaConsumerLogEntity ywuKafkaConsumer) {
        return service.queryKafkaConsumerLog(ywuKafkaConsumer);
    }

    /**
    * @Author GroundDemo
    * @Description 主题与订阅授权删除
    * @Date 14:31 2025/3/28
    * @Param [ywuKafkaDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/kafka.topic.app.sub.delete.info.for.spi")
    public CommonResult<Object> topicSubDeleteByAppId(@RequestBody YwuKafkaDto ywuKafkaDto) {
        return service.topicSubDeleteByAppId(ywuKafkaDto);
    }
}
